package com.team2.outpatient_sys.service.impl;

import com.github.pagehelper.PageHelper;
import com.team2.outpatient_sys.dao.ProvideMedicineDao;
import com.team2.outpatient_sys.pojo.Dispense;
import com.team2.outpatient_sys.pojo.Medicine;
import com.team2.outpatient_sys.pojo.ProvideMedicine;
import com.team2.outpatient_sys.service.ProvideMedicineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class ProvideMedicineServiceImpl implements ProvideMedicineService {

    @Autowired
    private ProvideMedicineDao provideMedicineDao;

    @Override
    public boolean add(ProvideMedicine provideMedicine) {
        return provideMedicineDao.add(provideMedicine) > 1 ? false : true;
    }

    @Override
    public boolean delete(Integer id) {
        return provideMedicineDao.delete(id) > 1 ? false : true;
    }


    @Override
    public boolean update(ProvideMedicine provideMedicine) {
        return provideMedicineDao.update(provideMedicine) > 1 ? false : true;
    }

    @Override
    public List<ProvideMedicine> findAll() {
        return provideMedicineDao.findAll();
    }

    @Override
    public ProvideMedicine findById(Integer id) {
        return provideMedicineDao.findById(id);
    }

//    @Override
//    public List<Dispense> findProvideMedicine(Integer patientId, Integer dispenseId) {
//        List<Dispense> list=provideMedicineDao.findProvideMedicine(patientId, dispenseId);
//        return list;
//    }
//
//    @Override
//    public List<Dispense> findByPage(Integer currentPage, Integer pageSize) {
//        PageHelper.startPage(currentPage,pageSize);
//        List<Dispense> list=provideMedicineDao.findProvideMedicine(1,1);
//        return list;
//    }

}
